const state = {
  showAnnouncement: false,
  title: '系统公告',
  content: '这是系统的最新公告内容，每次登录都会显示'
}

const mutations = {
  SHOW(state, { title, content } = {}) {
    state.showAnnouncement = true
    if (title) state.title = title
    if (content) state.content = content
  },
  HIDE(state) {
    state.showAnnouncement = false
  }
}

const actions = {
  show({ commit }, payload) {
    commit('SHOW', payload)
  },
  hide({ commit }) {
    commit('HIDE')
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
